﻿@{
    ViewBag.Title = "开通";
}
@using EmoneyWeiXinEntity;
@{
    WXUserEntity currentUser = ViewBag.CurrentUser;
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>开通</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link href="@Url.Content("~/Static/css/vipuser.css")" rel="stylesheet" />
    <script src="@Url.Content("~/Static/Js/zepto.js")"></script>
    <script src="@Url.Content("~/Static/Js/jquery-1.7.1.min.js")"></script>
    <script type="text/javascript">
        (function ($) {
            $(function () {
                initEvent();
            });

            function initEvent() {
                $("#btnKT").click(function () {
                    var qqNumber = $("#txtQQ").val();
                    var phoneNumber = $("#txtPhone").val();
                    var openId = '@currentUser.openid';
                    var weixinId = '@currentUser.weixinUserid';
                    var regQQ = /^\d{6,10}$/;
                    if ($.trim(qqNumber) != "" && !regQQ.test(qqNumber)) {
                        alert("QQ号码填写不正确");
                        return false;
                    }
                    var regPhone = /^1\d{10}$/;
                    if ($.trim(phoneNumber) != "" && !regPhone.test(phoneNumber)) {
                        alert("手机号码不正确")
                        return false;
                    }
                    if ($.trim(qqNumber) == "" && $.trim(phoneNumber) == "") {
                        alert("手机号码和QQ号码请至少填写一个！");
                        return;
                    }
                    $.ajax({
                        type: "post",
                        url: "@Url.Action("DoKaiTong", "VipUser")",
                        data: { openId: openId, phone: phoneNumber, qq: qqNumber, weixinId: weixinId },
                        success: function (data) {
                            if (data == "") {
                                window.location.href = "@Url.Action("NewsShow", "VipUser")?openid=@currentUser.openid";
                            }
                            else {
                                alert(data);
                            }
                        }
                    });



                });

                $("#txtQQ").focus(function () {
                    $(this).prev().prop("src", "@Url.Content("~/Static/Image/foucuesQQ.png")");
                });
                $("#txtQQ").blur(function () {
                    $(this).prev().prop("src", "@Url.Content("~/Static/Image/activate_qq.png")");
                });
                $("#txtPhone").focus(function () {
                    $(this).prev().prop("src", "@Url.Content("~/Static/Image/foucusPhone.png")");
                });
                $("#txtPhone").blur(function () {
                    $(this).prev().prop("src", "@Url.Content("~/Static/Image/activate_tel.png")");
                    });
                }

        })(jQuery);
    </script>
</head>
<body>

    <!--开通-->
    <div class="activate">
        <div class="activate_top">
            <h3>@currentUser.nickname，您好！</h3>
            <p>完成以下信息，立即开通微信VIP服务。</p>
        </div>
        <div class="activate_main">
            <ul>
                <li>
                    <img src="@Url.Content("~/Static/Image/activate_qq.png")" ><input type="text" id="txtQQ" placeholder="请输入您常用的QQ号"></li>
                <li>
                    <img src="@Url.Content("~/Static/Image/activate_tel.png")" ><input type="text" id="txtPhone" placeholder="请输入您常用的手机号码"></li>
            </ul>
        </div>
        <div class="activate_bottom">
            <h3>* 请保持QQ在线，或者手机畅通，我们将与您确认相<br>
                关开通信息。谢谢您的支持！<br>
                * 微信VIP服务不收取任何费用！</h3>
            <p><a href="#" id="btnKT">立即开通</a></p>
        </div>
    </div>
    <!--开通 end-->
</body>
</html>
